package net.lainiao.javademo.server;

import org.apache.commons.lang3.StringUtils;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Administrator on 2016/11/22.
 */
public class AppServer {
    public static void main(String[] args) throws IOException {
        String[] xmls=new String[]{"classpath:config/ApplicationContext.xml"};
        ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext(xmls);
        context.start();
        System.out.println("============================================");
        System.out.println("应用程序启动");
        System.out.println("============================================");
        BufferedReader reader= new BufferedReader(new InputStreamReader(System.in));
        boolean isContinue=true;
        while (isContinue){
            String readerLine=reader.readLine();
            if(StringUtils.isNotEmpty(readerLine)){
                if(readerLine.equalsIgnoreCase("q")){
                    break;
                }
            }
        }
        context.stop();
        System.out.println("============================================");
        System.out.println("应用程序结束");
        System.out.println("============================================");
    }
}
